export const pieEcharts = {
  tooltip: {
    trigger: 'item'
  },
  legend: {
    itemHeight: 12,
    itemWidth: 12,
    top: '85%',
    left: 'center',
    textStyle: {
      fontSize: 11
    },
  },
  width: 'auto',
  height: 'auto',
  color: ['#5470C6', '#91CC75', '#FAC858', '#EE6666', '#73C0DE'],
  series: [
    {
      name: 'Access From',
      type: 'pie',
      radius: ['40%', '65%'],
      center: ['50%', '40%'], 
      avoidLabelOverlap: false,
      itemStyle: {
        borderColor: '#fff',
        borderWidth: 2
      },
      label: {
        show: false,
        position: 'center'
      },
      emphasis: {
        label: {
          show: true,
          fontSize: '20',
          fontWeight: 'bold'
        }
      },
      labelLine: {
        show: false
      },
      data: [
        { value: 1048, name: '支付宝支付' },
        { value: 735, name: '微信支付' },
        { value: 580, name: '微信扫码' },
        { value: 484, name: '云闪付支付' },
        { value: 300, name: '支付宝二维码' }
      ]
    }
  ],
}

export const statisticsEcharts = {
  tooltip: {
    trigger: 'axis'
  },
  grid: {
    left: '3%',
    right: '4%',
    bottom: '13%',
    containLabel: true
  },
  
  xAxis: {
    type: 'category',
    boundaryGap: false,
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  dataZoom: [
    {
      type: 'inside',
      start: 0,
      end: 100
    },
    {
      start: 0,
      end: 100
    }
  ],
  legend: {
    icon: 'rect',
    itemHeight: 12,
    itemWidth: 12, 
    top: '2%',
    data: ['实际交易金额', '支付(成功)笔数','退款金额'],
    selected: { // 默认把后两项置灰
      '实际交易金额': true,
      '支付(成功)笔数': false,
      '退款金额': false
    }
  },
  series: [
    {
      name: '实际交易金额',
      type: 'line',
      areaStyle: {},
      symbol: 'none',
      smooth: true,
      data: []
    },
    {
      name: '支付(成功)笔数',
      type: 'line',
      areaStyle: {},
      symbol: 'none',
      smooth: true,
      data: []
    },
    {
      name: '退款金额',
      type: 'line',
      areaStyle: {},
      stack: 'Total',
      symbol: 'none',
      smooth: true,
      data: []
    }
  ],
  media: [ // 这里定义了 media query 的逐条规则。
    {
      query: { maxWidth: 700 },   // 这里写规则。
      option: {       // 这里写此规则满足下的option。
        legend: {
          top: '12%',
        },
        grid: {
          top: '20%',
        },
      }
    },
    {
      query: {minWidth:701, maxWidth: 1024 },   // 这里写规则。
      option: {       // 这里写此规则满足下的option。
        legend: {
          top: '2%',
          left: '15%'
        },
      }
    },
    {
      query: {minWidth:1025 },   // 这里写规则。
      option: {       // 这里写此规则满足下的option。
        legend: {
          left: '25%'
        },
      }
    }
    
  ]
}

export const amountEcharts = {
  xAxis: {
    type: 'category',
    axisLine: true,
    onZero: true,
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    axisLabel: {
      textStyle: {
        color: 'rgba(255, 255, 255, 0.5)',
      },
    },
    
    offset: 15
  },
  tooltip: {
    trigger: 'axis'
  },
  grid: {
    left: '2%',
    bottom: '20%',
    right: '2%',
    containLabel: false
  },
  yAxis: {
    show: false
  },
  series: [
    {
      lineStyle: {
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 1,
          y2: 0,
          colorStops: [{
              offset: 0, color: '#FFCC74' // 0% 处的颜色
          }, {
              offset: 1, color: '#FFFFFF' // 100% 处的颜色
          }],
          global: false // 缺省为 false
        },
        width: 7
      },
      data: [820, 932, 901, 934, 1290, 1330, 1320],
      type: 'line',
      smooth: true,
      symbol: 'none',
    }
  ],
  
}
